home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / PInterfaces / fp.p < prev    next >
Encoding:
Text File  |  1997-08-12  |  25.3 KB  |  577 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        fp.p
  3.  
  4.      Contains:    FPCE Floating-Point Definitions and Declarations.
  5.  
  6.      Version:    Technology:    MathLib v2
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1987-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT fp;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __FP__}
  28. {$SETC __FP__ := 1}
  29.  
  30. {$I+}
  31. {$SETC fpIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __CONDITIONALMACROS__}
  35. {$I ConditionalMacros.p}
  36. {$ENDC}
  37.  
  38. {$IFC UNDEFINED __TYPES__}
  39. {$I Types.p}
  40. {$ENDC}
  41. {*******************************************************************************
  42. *                                                                               *
  43. *    A collection of numerical functions designed to facilitate a wide          *
  44. *    range of numerical programming as required by C9X.                         *
  45. *                                                                               *
  46. *    The <fp.h> declares many functions in support of numerical programming.    *
  47. *    It provides a superset of <math.h> and <SANE.h> functions.  Some           *
  48. *    functionality previously found in <SANE.h> and not in the FPCE <fp.h>      *
  49. *    can be found in this <fp.h> under the heading "__NOEXTENSIONS__".          *
  50. *                                                                               *
  51. *    All of these functions are IEEE 754 aware and treat exceptions, NaNs,      *
  52. *    positive and negative zero and infinity consistent with the floating-      *
  53. *    point standard.                                                            *
  54. *                                                                               *
  55. *******************************************************************************}
  56.  
  57.  
  58. {$PUSH}
  59. {$ALIGN MAC68K}
  60. {$LibExport+}
  61.  
  62. {*******************************************************************************
  63. *                                                                               *
  64. *                            Efficient types                                    *
  65. *                                                                               *
  66. *    float_t         Most efficient type at least as wide as float              *
  67. *    double_t        Most efficient type at least as wide as double             *
  68. *                                                                               *
  69. *      CPU            float_t(bits)                double_t(bits)               *
  70. *    --------        -----------------            -----------------             *
  71. *    PowerPC          float(32)                    double(64)                   *
  72. *    68K              long double(80/96)           long double(80/96)           *
  73. *                                                                               *
  74. *******************************************************************************}
  75. {$IFC TARGET_CPU_PPC }
  76.  
  77. TYPE
  78.     float_t                                = Single;
  79.     double_t                            = Double;
  80. {$ELSEC}
  81. {$IFC TARGET_CPU_68K }
  82. TYPE
  83.     float_t                             = extended;
  84.     double_t                            = extended;
  85. {$ELSEC}
  86. { Unsupported CPU }
  87. {$ENDC}
  88. {$ENDC}
  89.  
  90.  
  91. {*******************************************************************************
  92. *                                                                               *
  93. *                              Define some constants.                           *
  94. *                                                                               *
  95. *    HUGE_VAL            IEEE 754 value of infinity.                            *
  96. *    INFINITY            IEEE 754 value of infinity.                            *
  97. *    NAN                 A generic NaN (Not A Number).                          *
  98. *    DECIMAL_DIG         Satisfies the constraint that the conversion from      *
  99. *                        double to decimal and back is the identity function.   *
  100. *                                                                               *
  101. *******************************************************************************}
  102.  
  103. CONST
  104. {$IFC TARGET_CPU_PPC }
  105.     DECIMAL_DIG                            = 17;  
  106. {$ELSEC}
  107.     DECIMAL_DIG                            = 21;
  108. {$ENDC}
  109.  
  110.  
  111. {*******************************************************************************
  112. *                                                                               *
  113. *                            Trigonometric functions                            *
  114. *                                                                               *
  115. *   acos        result is in [0,pi].                                            *
  116. *   asin        result is in [-pi/2,pi/2].                                      *
  117. *   atan        result is in [-pi/2,pi/2].                                      *
  118. *   atan2       Computes the arc tangent of y/x in [-pi,pi] using the sign of   *
  119. *               both arguments to determine the quadrant of the computed value. *
  120. *                                                                               *
  121. *******************************************************************************}
  122. FUNCTION cos(x: double_t): double_t; C;
  123. FUNCTION sin(x: double_t): double_t; C;
  124. FUNCTION tan(x: double_t): double_t; C;
  125. FUNCTION acos(x: double_t): double_t; C;
  126. FUNCTION asin(x: double_t): double_t; C;
  127. FUNCTION atan(x: double_t): double_t; C;
  128. FUNCTION atan2(y: double_t; x: double_t): double_t; C;
  129.  
  130.  
  131. {*******************************************************************************
  132. *                                                                                *
  133. *                              Hyperbolic functions                             *
  134. *                                                                                *
  135. *******************************************************************************}
  136. FUNCTION cosh(x: double_t): double_t; C;
  137. FUNCTION sinh(x: double_t): double_t; C;
  138. FUNCTION tanh(x: double_t): double_t; C;
  139. FUNCTION acosh(x: double_t): double_t; C;
  140. FUNCTION asinh(x: double_t): double_t; C;
  141. FUNCTION atanh(x: double_t): double_t; C;
  142.  
  143.  
  144. {*******************************************************************************
  145. *                                                                                *
  146. *                              Exponential functions                               *
  147. *                                                                                *
  148. *    expm1        expm1(x) = exp(x) - 1.  But, for small enough arguments,          *
  149. *                expm1(x) is expected to be more accurate than exp(x) - 1.        *
  150. *    frexp        Breaks a floating-point number into a normalized fraction       *
  151. *                and an integral power of 2.  It stores the integer in the       *
  152. *                object pointed by *exponent.                                    *
  153. *    ldexp        Multiplies a floating-point    number by an integer power of 2.    *
  154. *    log1p        log1p = log(1 + x). But, for small enough arguments,              *
  155. *                 log1p is expected to be more accurate than log(1 + x).          *
  156. *    logb        Extracts the exponent of its argument, as a signed integral        *
  157. *                  value. A subnormal argument is treated as though it were first    *
  158. *                  normalized. Thus:                                                *
  159. *                                     1   <=   x * 2^(-logb(x))   <   2             *
  160. *    modf        Returns fractional part of x as function result and returns     *
  161. *                integral part of x via iptr. Note C9X uses double not double_t.    *
  162. *    scalb        Computes x * 2^n efficently.  This is not normally done by        *
  163. *                  computing 2^n explicitly.                                         *
  164. *                                                                                *
  165. *******************************************************************************}
  166. FUNCTION exp(x: double_t): double_t; C;
  167. FUNCTION expm1(x: double_t): double_t; C;
  168. FUNCTION exp2(x: double_t): double_t; C;
  169. FUNCTION frexp(x: double_t; VAR exponent: LONGINT): double_t; C;
  170. FUNCTION ldexp(x: double_t; n: LONGINT): double_t; C;
  171. FUNCTION log(x: double_t): double_t; C;
  172. FUNCTION log2(x: double_t): double_t; C;
  173. FUNCTION log1p(x: double_t): double_t; C;
  174. FUNCTION log10(x: double_t): double_t; C;
  175. FUNCTION logb(x: double_t): double_t; C;
  176. FUNCTION modf(x: double_t; VAR iptr: double_t): double_t; C;
  177. FUNCTION modff(x: Single; VAR iptrf: Single): Single; C;
  178. FUNCTION scalb(x: double_t; n: LONGINT): double_t; C;
  179.  
  180.  
  181. {*******************************************************************************
  182. *                                                                                *
  183. *                     Power and absolute value functions                          *
  184. *                                                                                *
  185. *    hypot        Computes the square root of the sum of the squares of its        *
  186. *                  arguments, without undue overflow or underflow.                 *
  187. *    pow            Returns x raised to the power of y.  Result is more accurate    *
  188. *                than using exp(log(x)*y).                                        *
  189. *                                                                                *
  190. *******************************************************************************}
  191. FUNCTION fabs(x: double_t): double_t; C;
  192. FUNCTION hypot(x: double_t; y: double_t): double_t; C;
  193. FUNCTION pow(x: double_t; y: double_t): double_t; C;
  194. FUNCTION sqrt(x: double_t): double_t; C;
  195.  
  196.  
  197. {*******************************************************************************
  198. *                                                                                 *
  199. *                        Gamma and Error functions                               *
  200. *                                                                                 *
  201. *     erf            The error function.                                             *
  202. *     erfc        Complementary error function.                                      *
  203. *     gamma        The gamma function.                                                *
  204. *     lgamma        Computes the base-e logarithm of the absolute value of            *
  205. *                 gamma of its argument x, for x > 0.                                *
  206. *                                                                                 *
  207. *******************************************************************************}
  208. FUNCTION erf(x: double_t): double_t; C;
  209. FUNCTION erfc(x: double_t): double_t; C;
  210. FUNCTION gamma(x: double_t): double_t; C;
  211. FUNCTION lgamma(x: double_t): double_t; C;
  212.  
  213.  
  214. {*******************************************************************************
  215. *                                                                                 *
  216. *                        Nearest integer functions                                 *
  217. *                                                                                 *
  218. *     rint        Rounds its argument to an integral value in floating point         *
  219. *                  format, honoring the current rounding direction.                   *
  220. *                                                                                 *
  221. *     nearbyint    Differs from rint only in that it does not raise the inexact    *
  222. *               exception. It is the nearbyint function recommended by the        *
  223. *                  IEEE floating-point standard 854.                                  *
  224. *                                                                                 *
  225. *     rinttol        Rounds its argument to the nearest long int using the current     *
  226. *                  rounding direction.  NOTE: if the rounded value is outside        *
  227. *                the range of long int, then the result is undefined.              *
  228. *                                                                                  *
  229. *     round        Rounds the argument to the nearest integral value in floating     *
  230. *                  point format similar to the Fortran "anint" function. That is:  *
  231. *                  add half to the magnitude and chop.                             *
  232. *                                                                                 *
  233. *     roundtol    Similar to the Fortran function nint or to the Pascal round.    *
  234. *                 NOTE: if the rounded value is outside the range of long int,    *
  235. *                  then the result is undefined.                                      *
  236. *                                                                                 *
  237. *     trunc        Computes the integral value, in floating format, nearest to        *
  238. *                 but no larger in magnitude than its argument.      NOTE: on 68K    *
  239. *                compilers when using -elems881, trunc must return an int        *
  240. *                                                                                 *
  241. *******************************************************************************}
  242. FUNCTION ceil(x: double_t): double_t; C;
  243. FUNCTION floor(x: double_t): double_t; C;
  244. FUNCTION rint(x: double_t): double_t; C;
  245. FUNCTION nearbyint(x: double_t): double_t; C;
  246. FUNCTION rinttol(x: double_t): LONGINT; C;
  247. FUNCTION round(x: double_t): double_t; C;
  248. FUNCTION roundtol(round: double_t): LONGINT; C;
  249. {$IFC TARGET_CPU_68K }
  250. FUNCTION trunc(x: double_t): LONGINT; C;
  251. {$ELSEC}
  252. FUNCTION trunc(x: double_t): double_t; C;
  253. {$ENDC}  {TARGET_CPU_68K}
  254.  
  255.  
  256. {*******************************************************************************
  257. *                                                                                 *
  258. *                            Remainder functions                                   *
  259. *                                                                                 *
  260. *     remainder        IEEE 754 floating point standard for remainder.                *
  261. *     remquo            SANE remainder.  It stores into 'quotient' the 7 low-order    *
  262. *                    bits of the integer quotient x/y, such that:                *
  263. *                        -127 <= quotient <= 127.                                 *
  264. *                                                                                 *
  265. *******************************************************************************}
  266. FUNCTION fmod(x: double_t; y: double_t): double_t; C;
  267. FUNCTION remainder(x: double_t; y: double_t): double_t; C;
  268. FUNCTION remquo(x: double_t; y: double_t; VAR quo: LONGINT): double_t; C;
  269.  
  270.  
  271. {*******************************************************************************
  272. *                                                                                 *
  273. *                             Auxiliary functions                               *
  274. *                                                                                 *
  275. *     copysign        Produces a value with the magnitude of its first argument    *
  276. *                      and sign of its second argument.  NOTE: the order of the     *
  277. *                      arguments matches the recommendation of the IEEE 754         *
  278. *                    floating point standard,  which is opposite from the SANE    *
  279. *                    copysign function.                                             *
  280. *                                                                                 *
  281. *     nan                The call 'nan("n-char-sequence")' returns a quiet NaN         *
  282. *                      with content indicated through tagp in the selected         *
  283. *                    data type format.                                              *
  284. *                                                                                *
  285. *     nextafter        Computes the next representable value after 'x' in the         *
  286. *                    direction of 'y'.  if x == y, then y is returned.            *
  287. *                                                                                 *
  288. *******************************************************************************}
  289. FUNCTION copysign(x: double_t; y: double_t): double_t; C;
  290. FUNCTION nan(tagp: ConstCStringPtr): Double; C;
  291. FUNCTION nanf(tagp: ConstCStringPtr): Single; C;
  292. FUNCTION nextafterd(x: Double; y: Double): Double; C;
  293. FUNCTION nextafterf(x: Single; y: Single): Single; C;
  294.  
  295.  
  296. {*******************************************************************************
  297. *                                                                                 *
  298. *                              Inquiry macros                                   *
  299. *                                                                                 *
  300. *     fpclassify        Returns one of the FP_≈ values.                                *
  301. *     isnormal        Non-zero if and only if the argument x is normalized.          *
  302. *     isfinite        Non-zero if and only if the argument x is finite.             *
  303. *     isnan            Non-zero if and only if the argument x is a NaN.              *
  304. *     signbit            Non-zero if and only if the sign of the argument x is        *
  305. *                      negative.  This includes, NaNs, infinities and zeros.         *
  306. *                                                                                 *
  307. *******************************************************************************}
  308.  
  309. CONST
  310.     FP_SNAN                        = 0;                            {       signaling NaN                          }
  311.     FP_QNAN                        = 1;                            {       quiet NaN                              }
  312.     FP_INFINITE                    = 2;                            {       + or - infinity                        }
  313.     FP_ZERO                        = 3;                            {       + or - zero                            }
  314.     FP_NORMAL                    = 4;                            {       all normal numbers                     }
  315.     FP_SUBNORMAL                = 5;                            {       denormal numbers                       }
  316.  
  317. FUNCTION __fpclassifyd(x: Double): LONGINT; C;
  318. FUNCTION __fpclassifyf(x: Single): LONGINT; C;
  319. FUNCTION __isnormald(x: Double): LONGINT; C;
  320. FUNCTION __isnormalf(x: Single): LONGINT; C;
  321. FUNCTION __isfinited(x: Double): LONGINT; C;
  322. FUNCTION __isfinitef(x: Single): LONGINT; C;
  323. FUNCTION __isnand(x: Double): LONGINT; C;
  324. FUNCTION __isnanf(x: Single): LONGINT; C;
  325. FUNCTION __signbitd(x: Double): LONGINT; C;
  326. FUNCTION __signbitf(x: Single): LONGINT; C;
  327. FUNCTION __inf: double_t; C;
  328.  
  329.  
  330. {*******************************************************************************
  331. *                                                                                 *
  332. *                      Max, Min and Positive Difference                         *
  333. *                                                                                 *
  334. *     fdim        Determines the 'positive difference' between its arguments:     *
  335. *                ( x - y, if x > y ), ( +0, if x <= y ).  If one argument is        *
  336. *                  NaN, then fdim returns that NaN.  if both arguments are NaNs,     *
  337. *                 then fdim returns the first argument.                            *
  338. *                                                                                 *
  339. *     fmax        Returns the maximum of the two arguments.  Corresponds to the    *
  340. *                max function in FORTRAN.  NaN arguments are treated as missing     *
  341. *                data.  If one argument is NaN and the other is a number, then     *
  342. *                the number is returned.  If both are NaNs then the first         *
  343. *                argument is returned.                                             *
  344. *                                                                                 *
  345. *     fmin        Returns the minimum of the two arguments.  Corresponds to the    *
  346. *                min function in FORTRAN.  NaN arguments are treated as missing     *
  347. *                data.  If one argument is NaN and the other is a number, then     *
  348. *                the number is returned.  If both are NaNs then the first         *
  349. *                argument is returned.                                            *
  350. *                                                                                 *
  351. *******************************************************************************}
  352. FUNCTION fdim(x: double_t; y: double_t): double_t; C;
  353. FUNCTION fmax(x: double_t; y: double_t): double_t; C;
  354. FUNCTION fmin(x: double_t; y: double_t): double_t; C;
  355.  
  356.  
  357. {******************************************************************************
  358. *                                Constants                                     *
  359. ******************************************************************************}
  360.  
  361.  
  362. {*******************************************************************************
  363. *                                                                                 *
  364. *                              Non NCEG extensions                                *
  365. *                                                                                 *
  366. *******************************************************************************}
  367. {$IFC TARGET_OS_MAC }
  368. {$IFC UNDEFINED __NOEXTENSIONS__ }
  369. {*******************************************************************************
  370. *                                                                                 *
  371. *                              Financial functions                              *
  372. *                                                                                 *
  373. *     compound        Computes the compound interest factor "(1 + rate)^periods"    *
  374. *                      more accurately than the straightforward computation with     *
  375. *                    the Power function.  This is SANE's compound function.      *
  376. *                                                                                 *
  377. *     annuity            Computes the present value factor for an annuity             *
  378. *                      "(1 - (1 + rate)^(-periods)) /rate" more accurately than    *
  379. *                    the straightforward computation with the Power function.     *
  380. *                    This is SANE's annuity function.                              *
  381. *                                                                                 *
  382. *******************************************************************************}
  383. FUNCTION compound(rate: double_t; periods: double_t): double_t; C;
  384. FUNCTION annuity(rate: double_t; periods: double_t): double_t; C;
  385.  
  386.  
  387. {*******************************************************************************
  388. *                                                                                 *
  389. *                              Random function                                  *
  390. *                                                                                 *
  391. *     randomx            A pseudorandom number generator.  It uses the iteration:    *
  392. *                                (75*x)mod(2^31-1)                                *
  393. *                                                                                 *
  394. *******************************************************************************}
  395. FUNCTION randomx(VAR x: double_t): double_t; C;
  396.  
  397.  
  398. {******************************************************************************
  399. *                              Relational operator                             *
  400. ******************************************************************************}
  401. {      relational operator      }
  402.  
  403. TYPE
  404.     relop                                = INTEGER;
  405.  
  406. CONST
  407.     GREATERTHAN                    = 0;
  408.     LESSTHAN                    = 1;
  409.     EQUALTO                        = 2;
  410.     UNORDERED                    = 3;
  411.  
  412. FUNCTION relation(x: double_t; y: double_t): relop; C;
  413.  
  414.  
  415. {*******************************************************************************
  416. *                                                                                 *
  417. *                         Binary to decimal conversions                         *
  418. *                                                                                 *
  419. *     SIGDIGLEN    Significant decimal digits.                                        *
  420. *                                                                                 *
  421. *     decimal        A record which provides an intermediate unpacked form for        *
  422. *                programmers who wish to do their own parsing of numeric input     *
  423. *                or formatting of numeric output.                                  *
  424. *                                                                                 *
  425. *     decform        Controls each conversion to a decimal string.  The style field     *
  426. *                is either FLOATDECIMAL or FIXEDDECIMAL. If FLOATDECIMAL, the     *
  427. *                value of the field digits is the number of significant digits.  *
  428. *                  If FIXEDDECIMAL value of the field digits is the number of        *
  429. *                digits to the right of the decimal point.                         *
  430. *                                                                                 *
  431. *     num2dec        Converts a double_t to a decimal record    using a decform.        *
  432. *     dec2num        Converts a decimal record d to a double_t value.                *
  433. *     dec2str        Converts a decform and decimal to a string using a decform.        *
  434. *     str2dec        Converts a string to a decimal struct.                            *
  435. *     dec2d        Similar to dec2num except a double is returned (68k only).        *
  436. *     dec2f        Similar to dec2num except a float is returned.                    *
  437. *     dec2s        Similar to dec2num except a short is returned.                    *
  438. *     dec2l        Similar to dec2num except a long is returned.                     *
  439. *                                                                                 *
  440. *******************************************************************************}
  441.  
  442. CONST
  443. {$IFC TARGET_CPU_PPC }
  444.     SIGDIGLEN                    = 36;
  445. {$ELSEC}
  446.     SIGDIGLEN                    = 20;
  447. {$ENDC}
  448.     DECSTROUTLEN                = 80;
  449. TYPE
  450.     DecimalKind = (FLOATDECIMAL, FIXEDDECIMAL);
  451.  
  452.  
  453.     Decimal = RECORD
  454.         sgn:     0..1;            { sign 0 for +, 1 for -  }
  455.         exp:     INTEGER;
  456.         sig:     STRING[SIGDIGLEN];
  457.     END;
  458.  
  459.     Decform = RECORD
  460.         style:     DecimalKind;
  461.         digits: INTEGER;
  462.     END;
  463.  
  464. PROCEDURE num2dec({CONST}VAR f: decform; x: double_t; VAR d: decimal); C;
  465. FUNCTION dec2num({CONST}VAR d: decimal): double_t; C;
  466. PROCEDURE dec2str({CONST}VAR f: decform; {CONST}VAR d: decimal; s: CStringPtr); C;
  467. PROCEDURE str2dec(s: ConstCStringPtr; VAR ix: INTEGER; VAR d: decimal; VAR vp: INTEGER); C;
  468. {$IFC TARGET_CPU_68K }
  469. FUNCTION dec2d({CONST}VAR d: decimal): Double; C;
  470. {$ENDC}
  471. FUNCTION dec2f({CONST}VAR d: decimal): Single; C;
  472. FUNCTION dec2s({CONST}VAR d: decimal): INTEGER; C;
  473. FUNCTION dec2l({CONST}VAR d: decimal): LONGINT; C;
  474.  
  475.  
  476.  
  477. {*******************************************************************************
  478. *                                                                                 *
  479. *                         68k-only Transfer Function Prototypes                 *
  480. *                                                                                 *
  481. *******************************************************************************}
  482. {$IFC TARGET_CPU_68K }
  483. {$IFC TARGET_RT_MAC_68881 }
  484. PROCEDURE x96tox80({CONST}VAR x: extended96; VAR x80: extended80); C;
  485. PROCEDURE x80tox96({CONST}VAR x80: extended80; VAR x: extended96); C;
  486. {$ELSEC}
  487. PROCEDURE x96tox80({CONST}VAR x96: extended96; VAR x: extended80); C;
  488. PROCEDURE x80tox96({CONST}VAR x: extended80; VAR x96: extended96); C;
  489. {$ENDC}
  490. {$ENDC}
  491. {$ENDC}
  492. {$ENDC}  {TARGET_OS_MAC}
  493.  
  494. {*******************************************************************************
  495. *                                                                                 *
  496. *                         PowerPC-only Function Prototypes                         *
  497. *                                                                                 *
  498. *******************************************************************************}
  499.  
  500. {$IFC TARGET_CPU_PPC }
  501. FUNCTION cosl(x: LongDouble): LongDouble; C;
  502. FUNCTION sinl(x: LongDouble): LongDouble; C;
  503. FUNCTION tanl(x: LongDouble): LongDouble; C;
  504. FUNCTION acosl(x: LongDouble): LongDouble; C;
  505. FUNCTION asinl(x: LongDouble): LongDouble; C;
  506. FUNCTION atanl(x: LongDouble): LongDouble; C;
  507. FUNCTION atan2l(y: LongDouble; x: LongDouble): LongDouble; C;
  508. FUNCTION coshl(x: LongDouble): LongDouble; C;
  509. FUNCTION sinhl(x: LongDouble): LongDouble; C;
  510. FUNCTION tanhl(x: LongDouble): LongDouble; C;
  511. FUNCTION acoshl(x: LongDouble): LongDouble; C;
  512. FUNCTION asinhl(x: LongDouble): LongDouble; C;
  513. FUNCTION atanhl(x: LongDouble): LongDouble; C;
  514. FUNCTION expl(x: LongDouble): LongDouble; C;
  515. FUNCTION expm1l(x: LongDouble): LongDouble; C;
  516. FUNCTION exp2l(x: LongDouble): LongDouble; C;
  517. FUNCTION frexpl(x: LongDouble; VAR exponent: LONGINT): LongDouble; C;
  518. FUNCTION ldexpl(x: LongDouble; n: LONGINT): LongDouble; C;
  519. FUNCTION logl(x: LongDouble): LongDouble; C;
  520. FUNCTION log1pl(x: LongDouble): LongDouble; C;
  521. FUNCTION log10l(x: LongDouble): LongDouble; C;
  522. FUNCTION log2l(x: LongDouble): LongDouble; C;
  523. FUNCTION logbl(x: LongDouble): LongDouble; C;
  524. FUNCTION scalbl(x: LongDouble; n: LONGINT): LongDouble; C;
  525. FUNCTION fabsl(x: LongDouble): LongDouble; C;
  526. FUNCTION hypotl(x: LongDouble; y: LongDouble): LongDouble; C;
  527. FUNCTION powl(x: LongDouble; y: LongDouble): LongDouble; C;
  528. FUNCTION sqrtl(x: LongDouble): LongDouble; C;
  529. FUNCTION erfl(x: LongDouble): LongDouble; C;
  530. FUNCTION erfcl(x: LongDouble): LongDouble; C;
  531. FUNCTION gammal(x: LongDouble): LongDouble; C;
  532. FUNCTION lgammal(x: LongDouble): LongDouble; C;
  533. FUNCTION ceill(x: LongDouble): LongDouble; C;
  534. FUNCTION floorl(x: LongDouble): LongDouble; C;
  535. FUNCTION rintl(x: LongDouble): LongDouble; C;
  536. FUNCTION nearbyintl(x: LongDouble): LongDouble; C;
  537. FUNCTION rinttoll(x: LongDouble): LONGINT; C;
  538. FUNCTION roundl(x: LongDouble): LongDouble; C;
  539. FUNCTION roundtoll(round: LongDouble): LONGINT; C;
  540. FUNCTION truncl(x: LongDouble): LongDouble; C;
  541. FUNCTION remainderl(x: LongDouble; y: LongDouble): LongDouble; C;
  542. FUNCTION remquol(x: LongDouble; y: LongDouble; VAR quo: LONGINT): LongDouble; C;
  543. FUNCTION copysignl(x: LongDouble; y: LongDouble): LongDouble; C;
  544. FUNCTION fdiml(x: LongDouble; y: LongDouble): LongDouble; C;
  545. FUNCTION fmaxl(x: LongDouble; y: LongDouble): LongDouble; C;
  546. FUNCTION fminl(x: LongDouble; y: LongDouble): LongDouble; C;
  547.  
  548. {$IFC UNDEFINED __NOEXTENSIONS__ }
  549. FUNCTION relationl(x: LongDouble; y: LongDouble): relop; C;
  550. PROCEDURE num2decl({CONST}VAR f: decform; x: LongDouble; VAR d: decimal); C;
  551. FUNCTION dec2numl({CONST}VAR d: decimal): LongDouble; C;
  552. {$IFC TARGET_OS_MAC }
  553. {    
  554.     MathLib v2 has two new transfer functions: x80tod and dtox80.  They can 
  555.     be used to directly transform 68k 80-bit extended data types to double
  556.     and back for PowerPC based machines without using the functions
  557.     x80told or ldtox80.  Double rounding may occur. 
  558. }
  559. PROCEDURE x80told({CONST}VAR x80: extended80; VAR x: LongDouble); C;
  560. PROCEDURE ldtox80({CONST}VAR x: LongDouble; VAR x80: extended80); C;
  561. FUNCTION x80tod({CONST}VAR x80: extended80): Double; C;
  562. PROCEDURE dtox80({CONST}VAR x: Double; VAR x80: extended80); C;
  563. {$ENDC}
  564. {$ENDC}
  565. {$ENDC}  {TARGET_CPU_PPC}
  566.  
  567. {$ALIGN RESET}
  568. {$POP}
  569.  
  570. {$SETC UsingIncludes := fpIncludes}
  571.  
  572. {$ENDC} {__FP__}
  573.  
  574. {$IFC NOT UsingIncludes}
  575.  END.
  576. {$ENDC}
  577.